//
//  MWShowroomCommonCell.m
//  XiRan-iOS
//
//  Created by liuyiming on 2019/10/26.
//  Copyright © 2019 Wood. All rights reserved.
//

#import "MWShowroomCommonCell.h"

@interface MWShowroomCommonCell ()

@property(nonatomic, strong) UIImageView *arrowIV;
@property(nonatomic, strong) UIView *deviderView;

@end

@implementation MWShowroomCommonCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setupPageSubviews];
        [self layoutPageSubviews];
        return self;
    }
    return self;
}

- (void)setupPageSubviews {
    _iconIV = [[UIImageView alloc] init];
    [self.contentView addSubview:_iconIV];
    
    _titleLB = [[UILabel alloc] init];
    _titleLB.numberOfLines = 0;
    _titleLB.font = MWFont(15);
    _titleLB.textColor = MWHexColor(@"#333333");
    [self.contentView addSubview:_titleLB];
    
    _arrowIV = [[UIImageView alloc] init];
    _arrowIV.image = [UIImage imageNamed:@"ic_arrow_right"];
    [self.contentView addSubview:_arrowIV];
    
    _deviderView = [[UIView alloc] init];
    _deviderView.backgroundColor = MWHexColor(@"#f2f2f2");
    [self.contentView addSubview:_deviderView];
}

- (void)layoutPageSubviews {
    [_iconIV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(16);
        make.centerY.equalTo(self.contentView);
        make.width.equalTo(@16);
        make.height.equalTo(@23);
    }];
    
    [_titleLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(15);
        make.left.equalTo(self.iconIV.mas_right).offset(15);
        make.right.equalTo(self.arrowIV.mas_left).offset(-15);
        make.bottom.equalTo(self.contentView).offset(-15);
    }];
    
    [_arrowIV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView).offset(-16);
        make.centerY.equalTo(self.contentView);
        make.width.equalTo(@8);
        make.height.equalTo(@15);
    }];
    
    [_deviderView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.equalTo(self.contentView);
        make.height.equalTo(@0.5);
    }];
}

@end
